package com.xjtu.platform.admin.dao;

import com.xjtu.platform.admin.dto.bjyDto.BorrowStaticDto;
import com.xjtu.platform.admin.entity.AdminBookBaseInfo;
import com.xjtu.platform.admin.entity.AdminBorrowReaderInfo;
import com.xjtu.platform.reader.entity.BorrowHisBaseInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BjyAdminDao {

    @Select("select * from reader_book_borrow_his where " +
            "book_id in (select book_id from book where book_name like #{dto.book_name}) " +
            "and " +
            "reader_id in (select reader_id from reader where name like #{dto.reader_name}) " +
            "and " +
            "borrow_state like #{dto.borrow_state}")
    List<BorrowHisBaseInfo> getAdminBorrowBaseInfoList(@Param("dto") BorrowStaticDto borrowStaticDto);

    @Select("select * from book where book_id = #{bookId}")
    AdminBookBaseInfo getBookBaseInfo(String bookId);

    @Select("select * from reader where reader_id =#{readerId}")
    AdminBorrowReaderInfo getReaderBorrowInfo(String readerId);
}
